#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

const int N = 1e6 + 10, INF = 0x3f3f3f3f;

int n, m, root, idx;
struct node
{
    int ls, rs;
    int val, pri;
    int size, lazy;
}t[N];

int newnode(int v)
{
    idx++;
    t[idx].ls = t[idx].rs = t[idx].lazy = 0;
    t[idx].val = v;
    t[idx].pri = rand();
    t[idx].size = 1;
    return idx;
}

void pushup(int x) { t[x].size = t[t[x].ls].size + t[t[x].rs].size + 1; }
void pushdown(int x) {
    if (t[x].lazy) {
        swap(t[x].ls, t[x].rs);
        t[t[x].ls].lazy ^= 1, t[t[x].rs].lazy ^= 1;
        t[x].lazy = 0;
    }
}

void split(int x, int k, int& l, int& r)
{
    if (x == 0) { l = r = 0;  return; }
    pushdown(x);
    if (t[t[x].ls].size + 1 <= k) {
        l = x;
        split(t[x].rs, k - t[t[x].ls].size - 1, t[x].rs, r);
    } else {
        r = x;
        split(t[x].ls, k, l, t[x].ls);
    }
    pushup(x);
}

int merge(int l, int r)
{
    if (l == 0 || r == 0) return l + r;
    if (t[l].pri > t[r].pri) {
        pushdown(l);
        t[l].rs = merge(t[l].rs, r);
        pushup(l);
        return l;
    } else {
        pushdown(r);
        t[r].ls = merge(l, t[r].ls);
        pushup(r);
        return r;
    }
}

void dfs(int x)
{
    if (x == 0) return;
    pushdown(x);
    dfs(t[x].ls);
    cout << t[x].val << ' ';
    dfs(t[x].rs);
}

void solve()
{
    cin >> n >> m;
    for (int i = 1;i <= n;i++) root = merge(root, newnode(i));
    while (m--) {
        int x, y, l, r, p;cin >> x >> y;
        split(root, y, l, r);split(l, x - 1, l, p);
        t[p].lazy ^= 1;
        root = merge(merge(l, p), r);
    }
    dfs(root);
}

signed main()
{
    // ios::sync_with_stdio(0);
    // cin.tie(0);cout.tie(0);
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    srand(time(NULL));
    int T = 1;
    //cin>>T;
    for (int i = 1;i <= T;i++) {
        solve();
    }
}